Skip to content

Comments

make raster layer backward compatible#305

Merged
wang-boyu merged 4 commits intomesa:mainfrom
wang-boyu:raster-layer-backward-compatibility
Feb 17, 2026
Merged

make raster layer backward compatible#305
wang-boyu merged 4 commits intomesa:mainfrom
wang-boyu:raster-layer-backward-compatibility

Conversation

@wang-boyu
Copy link
Member

This is an attempt trying to make #299 less breaking.

Previously in our gis examples, we demonstrated how to subclass Cell:

class LakeCell(mesa_geo.Cell):
    def __init__(self, model, pos=None, indices=None):
        super().__init__(model, pos, indices)
        ...

But this will result in an error TypeError: LakeCell.__init__() got an unexpected keyword argument 'rowcol' with the changes in #299.

Therefore in mesa/mesa-examples#320 we update our gis example to update Cell subclass to:

class LakeCell(mesa_geo.Cell):
    def __init__(self, model=None, **kwargs):
        super().__init__(model, **kwargs)
        ...

To make it less breaking, in this PR we update the _initialize_cells method in RasterLayer so that it works with both the old and the new ways of subclassing Cell.

In addition, we also removed the deprecation warning for cell.pos since it inherits Mesa.Agent and its pos is set to None by default, trigging the warning (see mesa/mesa-examples#320 (comment)).

@wang-boyu wang-boyu requested review from EwoutH and tpike3 February 16, 2026 20:42
@wang-boyu wang-boyu added the maintenance Release notes label label Feb 16, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 16, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 69.56522% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.67%. Comparing base (b19c8ba) to head (d08077f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
mesa_geo/raster_layers.py 69.56% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #305      +/-   ##
==========================================
- Coverage   78.08%   77.67%   -0.42%     
==========================================
  Files          10       10              
  Lines         940      954      +14     
  Branches      144      146       +2     
==========================================
+ Hits          734      741       +7     
- Misses        169      174       +5     
- Partials       37       39       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@EwoutH EwoutH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't review line by line, but sounds good!

@wang-boyu
Copy link
Member Author

Thanks @EwoutH ! Merging now.

@wang-boyu wang-boyu merged commit 7343ec1 into mesa:main Feb 17, 2026
11 of 14 checks passed
@wang-boyu wang-boyu deleted the raster-layer-backward-compatibility branch February 17, 2026 16:40
@wang-boyu wang-boyu mentioned this pull request Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants